package com.bolehui.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.bolehui.domain.po.UserPO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

/**
 * @author chendongjie     email:chendongjie@gz.iscas.ac.cn
 * @version 1.0
 * @ClassName UserMapper
 * @Description
 * @createTime 2024/12/5 15:11
 * Copyright (C) 2021-2022 CASEEDER, All Rights Reserved.
 * 注意：本内容仅限于内部传阅，禁止外泄以及用于其他的商业目的
 */
@Mapper
public interface UserMapper extends BaseMapper<UserPO> {

    Long register(UserPO user);

    List<UserPO> selectListByName(String username);

    @Select("SELECT * FROM sys_user WHERE user_type != 0") // 不自动加 deleted=0 条件
    List<UserPO> selectByNameIncludeDeleted();

    @Update("UPDATE sys_user SET status = 0 WHERE user_id = #{id}")
    void open(@Param("id") Long id);
}
